\section{Level Creation in Maya}

Game levels can be created using Maya and exported into the correct format using
the LFA scene manager\footnote{\url{www.lfagames.com}}. There are a number of
important restrictions and necessary points to follow in order for the level to
export and run properly in the game.

Export options are set using the LFA scene manager window. This window is
displayed by running the \verb"lfa" mel command. Any changes made are not
automatically saved, so ensure you press `accept'.

\subsection{General Points}

\begin{itemize}

\item ID fields should be a comma separated list of values

\item To specify that an object should have physics representation for collision,
it should have \verb"ellipsoid", \verb"box", or \verb"tree" in its ID. For 
\verb"ellipsoid" and \verb"box" objects the physics collision object will be the 
same size as the bounding box of the object. These objects will also be movable 
both by the orb and by gravity. With tree objects the physics collision will be 
an exact representation of the object but as a result it will be a static, 
immovable object. If the ID of an object is left as the default of `0' it will 
be given a \verb"tree" physics object, to specify no physics make the ID empty.

\item The orb must have ID \verb"ellipsoid, orb".

\item You can still use groups of objects in Maya, but groups should not contain
any subgroups.

\item When exporting a level only export the meshes and the scene file. Multiple
material files can cause conflicts. See the section on `texturing' for available
materials.

\end{itemize}


\subsection{Level Geometry}

\begin{itemize}

\item All polygon meshes must not be scaled. To reset transformations use the
\verb"Modify > Freeze Transform" tool and only select scale.

\item It is simpler for polygons to have no construction history, you can either
disable construction history (icon in main toolbar), or by selecting 
\verb"Edit > Delete by Type > History".

\item For identical meshes in a scene, duplicate as instances rather than as a
copy. This means that only one mesh needs to be exported.

\end{itemize}


\subsection{Dynamic Level Elements}

\begin{itemize}

\item Score pick-ups can be placed using locators with ID either \verb"SCORE_1",
\verb"SCORE_2" or \verb"SCORE_3", where the point reward increases respectively.

\item Powerups are placed in the same way but with IDs
\verb"PU_LIFE", \verb"PU_TIME", \verb"PU_SIZE", \verb"PD_INVERT",
\verb"PU_SENSITIVITY", \verb"PD_GRAVITY".

\item Teleports are placed by assigning an ID of \verb"teleport" to a polygon
and an integer sub-ID to pair it with another teleport. For instance, to create
a teleport path, create two teleports both with sub-ID 1. 

\item Endzones are placed by assigning a polygon an ID of \verb"tree,goal" and
a particle system locator with a blank ID and file set to \verb"goal".

\item Moving objects are created by specifying a polygon as the object and
a set of locators as the path to follow. The platform must have an ID of
\verb"box,moving" and can have parameters delay and velocity specified in the
sub-ID, for instance: \verb"delay=0,velocity=10". A set of $n$ locators named
\verb"path_0",...,\verb"path_n" must be grouped under the platform polygon. The
platform will move in a loop from locator 0 to locator $n$ then back to locator
0. An additional sub-ID
parameter \verb"wait_for_orb" can be added to a locator or the platform to get
it to wait for the orb before moving. The position of the locators must be
relative to the platform polygon.

\end{itemize}

\subsection{Texturing}

The game already has a set of defined materials. These can be assigned to
objects simply by assigning a material of the same name. You must be sure though
not to export the materials file, otherwise there will be conflicting materials.
Alternatively you can create new materials, but ensure their names are unique to
the ones listed below. Textures can be accurately placed by changing the UV
space of a mesh.

The game currently has definitions for the following textures: \verb"grass",
\verb"metal",  \verb"concrete",  \verb"slabs_grey",  \verb"slabs_terracotta",
\verb"metal_grip" and  \verb"tiles".

\subsection{Lighting}

Lighting can be placed in the normal way. The LFA scene manager has an option to
view the range of a light source. Moving between the boundaries of different
light sources can produce strange effects in the game. It is better to ensure a
player cannot pass between light source boundaries.

\subsection{Integration with the Game}

\subsubsection{Creating a Folder for the Exported Data}
In order to integrate a level successfully with the game then you must export
all of the geometry in to the following folder with \verb"x" being the level
number:
\begin{verbatim}
ROOT_GAME_DIRECTORY\game\resources\levels\levelx\
\end{verbatim}

\subsubsection{Creating the Level Images}
The menu system makes use of two images when displaying a level in the level
selection screen. In order to have an image of your level appear within the
game you must create two 320x240 pixel images. These images should be identical,
but one must be colourless, with the other being colourful.

\subsubsection{Editing the Imageset File}
The next step is to edit the imageset file. This involves editing the
\verb"Levels.png" file and pasting your two images where ever there is a
vacant space. This can be done by using any image editing software such as
Photoshop, Paint Shop Pro or The GIMP. Make a note of the top-left positions of
each newly inserted image and type the following lines in the
\verb"Levels.imageset" file:
\begin{verbatim}
<Image Name="levelx-Normal" XPos="0" YPos="0"  Width="320" Height="240" />
<Image Name="levelx-Hover"  XPos="0" YPos="0" Width="320" Height="240" />
\end{verbatim}
Change the `x' so that it is the correct level number and edit the XPos and YPos
values so that they are positions you noted down when you inserted the images
in the \verb"Levels.png" file. Both of these files can be found within the
following folder:
\begin{verbatim}
ROOT_GAME_DIRECTORY\game\resources\menu\imagesets
\end{verbatim}

\subsubsection{Adding the Level}
Once you have done this you will need to edit the \verb"levels.ini" file which
can be found within the levels folder. Information concerning the level is held
within this file where an example of a level entry consists of:
\begin{verbatim}
[levelx]
SceneFile=levels/levelx/levelx.scene
ResourceType=FileSystem
ResourceLocation=levels/levelx
Timer=120
NormalImage=levelx-Normal
HoverImage=levelx-Hover
LevelName=Level x. Name of Level
\end{verbatim}
The only changes that need to be made to the example is the insertion of the
correct level number where ever an `x' is present. You may also specify the
time limit for the level and the name of the level. You should now be able to
run the game as normal and the level will appear within the game.
